Skip to content

Comments

feat: add start-only mode to keep Connect running#41

Merged
nealrichardson merged 5 commits intomainfrom
feat/start-only-mode
Feb 3, 2026
Merged

feat: add start-only mode to keep Connect running#41
nealrichardson merged 5 commits intomainfrom
feat/start-only-mode

Conversation

@nealrichardson
Copy link
Collaborator

Summary

  • When no command is provided after --, outputs JSON credentials (api_key, server, container_id) and keeps the container running
  • Adds --stop <container_id> flag to stop a running container
  • For GitHub Actions, adds outputs (api-key, server, container-id) and a stop input

Closes #9

Usage

CLI - Start only:

with-connect --license ./rstudio-connect.lic
# Outputs: {"api_key": "...", "server": "http://localhost:3939", "container_id": "..."}

CLI - Stop:

with-connect --stop <container_id>

GitHub Action:

- id: start-connect
  uses: posit-dev/with-connect@main
  with:
    license: ${{ secrets.CONNECT_LICENSE }}

- run: |
    curl -H "Authorization: Key ${{ steps.start-connect.outputs.api-key }}" \
      ${{ steps.start-connect.outputs.server }}/__api__/server_settings

- uses: posit-dev/with-connect@main
  with:
    stop: ${{ steps.start-connect.outputs.container-id }}

Test plan

  • Verify --stop argument appears in --help
  • Verify --stop with nonexistent container returns error
  • Manual test: start Connect without command, verify JSON output
  • Manual test: use container ID from JSON to stop container
  • CI test: verify GitHub Action outputs work in multi-step workflow

🤖 Generated with Claude Code

When no command is provided after `--`, outputs JSON credentials
(api_key, server, container_id) and keeps the container running.
Adds `--stop` flag to stop a running container by ID.

For GitHub Actions, adds outputs (api-key, server, container-id)
and a stop input, enabling multi-step workflows.

Closes #9

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
nealrichardson and others added 2 commits January 29, 2026 11:14
- Add test-action-start-only CI job that verifies outputs and stop
- Document --stop CLI option
- Document start-only mode for CLI
- Update GitHub Action inputs table (command now optional, add stop)
- Add GitHub Action outputs table
- Add multi-step workflow example

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Progress and diagnostic messages now go to stderr, leaving stdout
clean for machine-readable output (JSON in start-only mode).

This follows Unix conventions where stderr is used for diagnostic
output, similar to curl, wget, git, etc.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@nealrichardson
Copy link
Collaborator Author

@tdstein this is ready for review 🙏

Comment on lines 89 to 101
# Check if command is provided
if [ -z "${{ inputs.command }}" ]; then
# Start-only mode: capture JSON output and set outputs
OUTPUT=$(with-connect $ARGS)
echo "api-key=$(echo "$OUTPUT" | jq -r '.api_key')" >> $GITHUB_OUTPUT
echo "server=$(echo "$OUTPUT" | jq -r '.server')" >> $GITHUB_OUTPUT
echo "container-id=$(echo "$OUTPUT" | jq -r '.container_id')" >> $GITHUB_OUTPUT
else
# Run with command
with-connect $ARGS -- bash <<'SCRIPT'
${{ inputs.command }}
SCRIPT
fi
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit; is there a way to print these as bash variables so that one doesn't have to use jq to parse it.

Something like...

with-connect $ARGS | with-connect -- bash <<'SCRIPT'
    ${{ inputs.command }}
SCRIPT

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the suggestion, I did that, have a look and see what you think

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Looks great to me. Thanks!

- Output shell variables instead of JSON (CONNECT_API_KEY, CONNECT_SERVER, CONTAINER_ID)
- --stop without argument now uses CONTAINER_ID env var
- Update action.yml to parse shell format (no jq dependency)
- Update README with eval example

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Output names now match env var names (CONNECT_API_KEY, CONNECT_SERVER,
CONTAINER_ID), allowing direct piping to GITHUB_OUTPUT without parsing.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@nealrichardson nealrichardson merged commit 4f26a6a into main Feb 3, 2026
4 checks passed
@nealrichardson nealrichardson deleted the feat/start-only-mode branch February 3, 2026 21:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ability to start Connect and leave it running

2 participants